home *** CD-ROM | disk | FTP | other *** search
/ Champak 141 / (Vol 141) Oct 17 2011.iso / Games / gamma-bros.swf / scripts / __Packages / classes / shots / DeathBlast.as < prev    next >
Encoding:
Text File  |  2011-10-17  |  2.7 KB  |  123 lines

  1. class classes.shots.DeathBlast
  2. {
  3.    var x;
  4.    var y;
  5.    var id;
  6.    var rev;
  7.    var dir;
  8.    var clip;
  9.    var xMov;
  10.    var yMov;
  11.    var xInc;
  12.    var yInc;
  13.    var Name = "deathBlast";
  14.    var power = 30;
  15.    var yank = false;
  16.    function DeathBlast(px, py, pdir, prev, pid)
  17.    {
  18.       this.x = px;
  19.       this.y = py;
  20.       this.id = pid;
  21.       this.rev = prev;
  22.       this.dir = pdir;
  23.       _root.d = _root.d + 1;
  24.       this.clip = _root.attachMovie("deathBlast","deathBlast" + this.id + "Clip",_root.d + 1000);
  25.       this.clip._x = this.x;
  26.       this.clip._y = this.y;
  27.       this.clip.id = this.id;
  28.       if(this.dir == "R")
  29.       {
  30.          this.xMov = 13;
  31.          this.yMov = 0;
  32.          this.xInc = -0.5;
  33.          this.yInc = 0;
  34.       }
  35.       else if(this.dir == "L")
  36.       {
  37.          this.xMov = -13;
  38.          this.yMov = 0;
  39.          this.xInc = 0.5;
  40.          this.yInc = 0;
  41.       }
  42.       else if(this.dir == "U")
  43.       {
  44.          this.xMov = 0;
  45.          this.yMov = -13;
  46.          this.xInc = 0;
  47.          this.yInc = 0.5;
  48.       }
  49.       else if(this.dir == "D")
  50.       {
  51.          this.xMov = 0;
  52.          this.yMov = 13;
  53.          this.xInc = 0;
  54.          this.yInc = -0.5;
  55.       }
  56.       else if(this.dir == "LU")
  57.       {
  58.          this.xMov = -10;
  59.          this.yMov = -10;
  60.          this.xInc = 0.4;
  61.          this.yInc = 0.4;
  62.       }
  63.       else if(this.dir == "RU")
  64.       {
  65.          this.xMov = 10;
  66.          this.yMov = -10;
  67.          this.xInc = -0.4;
  68.          this.yInc = 0.4;
  69.       }
  70.       else if(this.dir == "RD")
  71.       {
  72.          this.xMov = 10;
  73.          this.yMov = 10;
  74.          this.xInc = -0.4;
  75.          this.yInc = -0.4;
  76.       }
  77.       else
  78.       {
  79.          this.xMov = -10;
  80.          this.yMov = 10;
  81.          this.xInc = 0.4;
  82.          this.yInc = -0.4;
  83.       }
  84.       this.xMov *= _root.dif.speed;
  85.       this.yMov *= _root.dif.speed;
  86.    }
  87.    function hit()
  88.    {
  89.       this.yank = true;
  90.    }
  91.    function main()
  92.    {
  93.       if(!this.rev)
  94.       {
  95.          this.xMov *= 1.01;
  96.          this.yMov *= 1.01;
  97.       }
  98.       else
  99.       {
  100.          this.xMov += this.xInc;
  101.          this.yMov += this.yInc;
  102.       }
  103.       if(this.clip.hitTest(_root[_root.char + "Clip"]))
  104.       {
  105.          _root[_root.char].hit(this.xMov,this.yMov,100,this.power);
  106.          this.yank = true;
  107.       }
  108.       if(this.x > 1050 || this.x < -50 || this.y > 650 || this.y < -50)
  109.       {
  110.          this.yank = true;
  111.       }
  112.       if(this.yank)
  113.       {
  114.          _root.removeEnemyShot("deathBlast" + this.id);
  115.          this.yank = false;
  116.       }
  117.       this.x += this.xMov;
  118.       this.y += this.yMov;
  119.       this.clip._x = this.x;
  120.       this.clip._y = this.y;
  121.    }
  122. }
  123.